package com.situ.iv.service.impl;
import java.util.List;

import com.situ.iv.entity.IvOutinvoice;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.situ.iv.service.IvOutinvoiceService;
import com.situ.iv.dao.IvOutinvoiceDao;

/**
 * IvOutinvoice的服务接口的实现类
 * 
 * @author 胡文 qq:986776
 *
 */
@Service
public class IvOutinvoiceServiceImpl implements IvOutinvoiceService {
	private final Logger LOG = LogManager.getLogger(this.getClass());

	@Autowired
	private IvOutinvoiceDao ivOutinvoiceDao;

/**
* 查询....
*/
	@Override
	public List<IvOutinvoice> find(IvOutinvoice value) {

		List<IvOutinvoice> result = ivOutinvoiceDao.selectIvOutinvoiceByObj(value);

		return result;
	}
    /**
* 根据id查询
*/
	@Override
	public IvOutinvoice findOne(Integer id) {

		IvOutinvoice result = ivOutinvoiceDao.selectIvOutinvoiceById(id);

		return result;
	}

/**
* 添加不为空
*/
	@Override
	public IvOutinvoice saveNotNull(IvOutinvoice value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行将IvOutinvoice中属性值不为null的数据保存到数据库-->失败:对象不能为空");
			}
			return value;
		}
		int result = ivOutinvoiceDao.insertNotNullIvOutinvoice(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行将IvOutinvoice中属性值不为null的数据保存到数据库-->结果:", result);
		}
		return value;
	}
	@Override
    /**
* 修改不为空
*/
	public int updateNotNullById(IvOutinvoice value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过IvOutinvoice的id更新IvOutinvoice中属性不为null的数据-->失败:对象为null");
			}
			return 0;
		}
		int result = ivOutinvoiceDao.updateNotNullIvOutinvoiceById(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过IvOutinvoice的id更新IvOutinvoice中属性不为null的数据-->结果:", result);
		}
		return result;
	}
    /**
* 删除
*/
	@Override
	public int deleteById(Integer id) {
		if (id == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过IvOutinvoice的id删除IvOutinvoice-->失败:id不能为空");
			}
			return 0;
		}
		int result = ivOutinvoiceDao.deleteIvOutinvoiceById(id);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过IvOutinvoice的id删除IvOutinvoice-->结果:", result);
		}
		return result;
	}


}